﻿<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeBehind="Inventory.aspx.cs" Inherits="MLY.LTR.Inventory"
  MasterPageFile="~/LTR/MlyLtrMaster.Master" %>

<%@ Register Assembly="DevExpress.Web.v11.1.Linq, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Data.Linq" TagPrefix="dx" %>

<%@ Register assembly="DevExpress.Data.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" 
namespace="DevExpress.Data" tagprefix="dx" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
  Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
  Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxPanel"
  TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxRoundPanel"
  TagPrefix="dx" %>
<%@ Register assembly="DevExpress.Web.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxLoadingPanel" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v11.1.Export, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView.Export" tagprefix="dx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="titleHolder" runat="server">
    <script language="javascript" type="text/javascript">
        var toRemove = new Array();
        var WorkOrders = new Array();
        
        function CheckboxClick(OrderId, CheckBoxName) {
            if (document.getElementById(CheckBoxName).checked)
                AddOrderIdToRemove(OrderId)
            else
                RemoveOrderIdToRemove(OrderId)
        }
        
        function AddOrderIdToRemove(OrderId) {
            toRemove.push(OrderId);
        }

        function RemoveOrderIdToRemove(OrderId) {
            var NewToRemove = new Array();
            for (var i = 0; i < toRemove.length;  i++) {
                if (toRemove[i] != OrderId)
                    NewToRemove.push(toRemove[i]);
            }
            toRemove = NewToRemove;
            
        }

        function WriteOrdersToRemove() {
            document.getElementById("ctl00_ContentPlaceHolder1_ToRemoveArrayHiddenField").value = toRemove;

            if (confirm("Are you sure you want to remove selected Orders?")) {
                toRemove = new Array();
                return true;
            }
            else
                return false;
        }

        function WriteOrdersToToggleDebate() {
            document.getElementById("ctl00_ContentPlaceHolder1_ToggleDebateArrayHiddenField").value = toRemove;
            if (confirm("Are you sure you want to change debate value of the selected orders?")) {
                toRemove = new Array();
                return true;
            }
            else
                return false;
            
        }

        function ClearArray() {
            toRemove.splice(0, toRemove.length);
        }

        function ShowDiv(divname) {
            $("#" + divname).show();
        }

        function HideDiv(divname) {
            $("#" + divname).hide();
        }

        function updateDate(str) {
            var today = new Date();

            document.getElementById("timeNotes").innerHTML += str + ": " + today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds() + "," + today.getMilliseconds() + "<br /> ";
        }

        function moveDemoToStep4() {
            setTimeout('doActualMoveToStep4()', 10000);
        }

        function doActualMoveToStep4() {
            if (document.getElementById("ctl00_ContentPlaceHolder1_DemoEnabled").value == "yes") {
                document.getElementById("ctl00_DemoLabel").innerHTML = "You can do many other things with your data here. Like adding new rows, edit your data, or advanced filtering.<br /> When ready for the next part of the demo - go to the Clients >> Reports in the menu";
                document.getElementById("ctl00_ContentPlaceHolder1_ExportToXLS").className = 'demostophighlight';
                document.getElementById("ctl00_Menu21_Literal1").className = 'demohighlight';
                document.getElementById("ctl00_Menu21_Literal5").className = 'demohighlight';
                document.getElementById("ctl00_ContentPlaceHolder1_DemoEnabled").value = "no";
            }
        }

        window.onload = function() {
            $("#inventory_menuitem").addClass('active');
        }
   </script> 
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <%--<span id="timeNotes"></span>--%>
    <script type="text/javascript">
      var prm = Sys.WebForms.PageRequestManager.getInstance();
      prm.add_initializeRequest(initializeRequest);
      prm.add_pageLoaded(pageLoaded);
      
      function initializeRequest(sender, args) {
          LoadingPanel.ShowInElement(args._postBackElement);
      }

      function pageLoaded(sender, args) {
          var panels = args.get_panelsUpdated();
          if (panels.length > 0) {
              LoadingPanel.Hide();
          }
      }

    </script>

<%--    <dx:LinqServerModeDataSource ID="InventoryDevXDataSource" runat="server"
     EnableInsert="True" EnableUpdate="True" EnableDelete="true" 
        ContextTypeName="MLY.Dal.lqKbmDataContext" 
        onselecting="DevxDataSourceSelecting" TableName="WorkOrdersViews" />--%>
    <asp:HiddenField ID="DemoEnabled" runat="server" Value="no" />
     
    <asp:LinqDataSource ID="InventoryDataSource" runat="server" EnableDelete="True" ContextTypeName="MLY.Dal.lqKbmDataContext"
      TableName="WorkOrdersViews" EnableInsert="True" EnableUpdate="True"
      OrderBy="(ActualDelivaryDate == null ? 1:0) DESC, ActualDelivaryDate DESC, (DateFieldB == null ? 1:0) DESC, DateFieldB DESC, (PlannedDelivaryDate == null ? 1:0) DESC, PlannedDelivaryDate DESC, WorkOrderId DESC">
    </asp:LinqDataSource>
    
    <asp:LinqDataSource ID="DistributionDataSource" runat="server" ContextTypeName="MLY.Dal.lqKbmDataContext" TableName="TableWorkOrders"
      Where="originalWoForDist == @originalWoForDist" EnableUpdate="True">
      <WhereParameters>
        <asp:SessionParameter Name="originalWoForDist" SessionField="MasterWorkWorderID" Type="Int32" DefaultValue="-2147483648" />
      </WhereParameters>
    </asp:LinqDataSource>
    <br />
    <asp:HiddenField ID="CheckBoxesHiddenField" runat="server" />
    <asp:HiddenField ID="WorkOrdersHiddenField" runat="server" />
    <asp:Label ID="TestLabel" runat="server"></asp:Label>
    <asp:UpdatePanel ID="InventoryUpdatePanel" runat="server" >
      <Triggers>
        <asp:PostBackTrigger ControlID="ExportToXLS" />
        <asp:PostBackTrigger ControlID="ExportToXLSx" />
        <asp:PostBackTrigger ControlID="ExportToPDF" />
      </Triggers>
      <ContentTemplate>
        <div class="floater">
            <asp:Label ID="PostDisqualifyMessage" runat="server" Text="Disqualify operation succeeded" Visible="false"></asp:Label>
        </div>
        <div class="clr"></div> 
        <div class="floater">
            <table cellpadding="5" cellspacing="0">
            <tr>
            <td>
                <%--<div onclick="javascript:moveDemoToStep4();">--%>
                <dx:ASPxButton Id="ExportToXLS" runat="server" Text="Export to XLS" UseSubmitBehavior="False"
                    OnClick="btnXlsExport_Click"  ></dx:ASPxButton>
                <%--</div> --%>                   
            </td>
            <td>
                <dx:ASPxButton Id="ExportToXLSx" runat="server" Text="Export to XLSx" UseSubmitBehavior="False"
                    OnClick="btnXlsxExport_Click"></dx:ASPxButton>
            </td>
            <td>
                <dx:ASPxButton Id="ExportToPDF" runat="server" Text="Export to PDF" UseSubmitBehavior="False"
                    OnClick="btnPdfExport_Click"></dx:ASPxButton>
            </td>
            </tr>
            </table>
            
            <br />
        </div>
    
        
        <div class="clr"></div>
        <div class="floater">
            <asp:Hyperlink ID="Inv1Link" runat="server" Text="Open edit options" CssClass="regFont"
             NavigateUrl="~/LTR/Inventory1.aspx?p=1.1.2.2&isclient=1"></asp:Hyperlink>
             <br /><br />
        </div>
        <div class="clr"></div>
        
        <dx:ASPxGridView ID="InventoryGrid" runat="server" 
        DataSourceID="InventoryDataSource" 
        AutoGenerateColumns="False" 
        KeyFieldName="WorkOrderId"
        OnCancelRowEditing="InventoryGrid_CancelRowEditing" 
        OnRowUpdated="InventoryGrid_RowUpdated" 
        OnStartRowEditing="InventoryGrid_StartRowEditing"
        Width="100%" OnCustomButtonCallback="InventoryGrid_CustomButtonCallback" 
        EnableCallBacks="False"
        OnRowInserting="InventoryGrid_RowInserting"
        OnRowUpdating="InventoryGrid_RowUpdating" 
        OnRowInserted="InventoryGrid_RowInserted" 
        OnHtmlRowPrepared="ASPxGridView1_HtmlRowPrepared"
        OnCustomUnboundColumnData="InventoryGrid_CustomUnboundColumnData" 
        SettingsPager-RenderMode="Lightweight"
        Settings-ShowVerticalScrollBar="false"
        EnableTheming="False"  >
        <SettingsBehavior AllowFocusedRow="True" ColumnResizeMode="NextColumn" AutoFilterRowInputDelay="2500"  />
        <SettingsEditing Mode="PopupEditForm" />
        <Columns>
            
          <dx:GridViewDataCheckColumn Width="30px" VisibleIndex="0" Name="RemoveCheckBox" EditFormSettings-Visible="False">
              <EditFormSettings Visible="False" />
            <DataItemTemplate> 

                <asp:CheckBox runat="server" Checked="false" ID="DeleteCheckBox"
                 onclick='<%# "CheckboxClick(" + Eval("WorkOrderId") + ", this.getAttribute(\"id\"))" %>' />
                <asp:HiddenField runat="server" ID="WorkOrderIdHiddenField" Value='<%# Eval("WorkOrderId") %>' />
                <div id='<%# Eval("WorkOrderId") %>' onload='<%# "AddWorkOrder(" + Eval("WorkOrderId") + ")" %>'></div>
            </DataItemTemplate>
            
          </dx:GridViewDataCheckColumn>
          <dx:GridViewCommandColumn VisibleIndex="0" Width="65px" >
          <CustomButtons>
              <dx:GridViewCommandColumnCustomButton ID="DisqualificationButton" Text="Disqualify" >
              </dx:GridViewCommandColumnCustomButton>
          </CustomButtons>
          </dx:GridViewCommandColumn>
          
          <dx:GridViewCommandColumn VisibleIndex="0" Width="120px" >
      
            <EditButton Visible="true">
            </EditButton>
            
            <CustomButtons>
              <dx:GridViewCommandColumnCustomButton ID="SpliterButton" Text="Split" >
              </dx:GridViewCommandColumnCustomButton>

              <dx:GridViewCommandColumnCustomButton ID="NewCustomButton" 
                                                    Text="New"
                                                    Visibility="FilterRow" >
              </dx:GridViewCommandColumnCustomButton>
              

            </CustomButtons>
            
            <HeaderStyle Wrap="True" />
            
          </dx:GridViewCommandColumn>
          
          <dx:GridViewDataTextColumn Caption="<%$ Dict:adminDefault.Organizations %> " 
          ReadOnly="True" VisibleIndex="10" FieldName="ContractorOrganizationName"
            Width="70px">
            
            <HeaderTemplate>
                <asp:Label ID="Label1" runat="server" Text="<%$ Dict:adminDefault.Organizations %>" ></asp:Label>
                <%--<asp:Label ID="OrgNameTitleLabel" runat="server" Text="<%$ Dict:adminDefault.Organizations %>"
                 onmouseover="ShowDiv('OrgNamehelp')" onmouseout="HideDiv('OrgNamehelp')" ></asp:Label>--%>
                <div id="OrgNamehelp" class="democlass popupDiv">
                    Organization name help text
                </div>
              
            </HeaderTemplate>
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
            <%--<DataItemTemplate>
                <%# GetOrgNameById(Eval("ContractorId")) %>
            </DataItemTemplate>--%>
          </dx:GridViewDataTextColumn>
          <dx:GridViewDataTextColumn Caption="<%$ Dict:adminDefault.Organizations %> " 
          FieldName="CustomerOrganizationName" ReadOnly="True" VisibleIndex="10" Width="70px">
           
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
            <%--<DataItemTemplate>
                <%# GetOrgNameById(Eval("CustomerId"))%>
            </DataItemTemplate>--%>
          </dx:GridViewDataTextColumn>
          <dx:GridViewDataTextColumn Caption="<%$ Dict:clientAddWo.Project %> "
           FieldName="Project" ReadOnly="false" VisibleIndex="28" Width="70px">
           <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
           
           </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn FieldName="CustomerWorkOrderNumber" VisibleIndex="30" Width="70px" 
                                     Caption="<%$ Dict:clientAddWo.CustomerWorkOrderNumber %>">
                                 
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn FieldName="ContractorWorkOrderNumber" VisibleIndex="40" Width="70px"
                                     Caption="<%$ Dict:clientAddWo.ContractorWorkOrderNumber %>"  >
                                 
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>        
          
          <dx:GridViewDataTextColumn FieldName="ContractorLotNumber" VisibleIndex="50" Width="70px" 
                                     Caption="<%$ Dict:ClienteditWoForm.ContractorLotNumber %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
            <Settings AllowAutoFilterTextInputTimer="False" />
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataDateColumn FieldName="SendDate" VisibleIndex="60" Width="70px"
                                     Caption="<%$ Dict:InventoryGrid.SendDateColumn %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
            
          </dx:GridViewDataDateColumn>
          
          <dx:GridViewDataDateColumn FieldName="RequestedDelivaryDate" VisibleIndex="70" Width="70px"
                                     Caption="<%$ Dict:ClienteditWoForm.RequestedDelivaryDate %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataDateColumn>
          
          <dx:GridViewDataDateColumn FieldName="PlannedDelivaryDate" VisibleIndex="80" Width="70px"
                                     Caption="<%$ Dict:ClienteditWoForm.PlannedDelivaryDate %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataDateColumn>
          
          <dx:GridViewDataDateColumn FieldName="ActualDelivaryDate" VisibleIndex="90" Width="70px"
                                     Caption="<%$ Dict:InventoryGrid.ActualDelivaryDateColumn %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataDateColumn>
          
          <dx:GridViewDataTextColumn FieldName="CustomerPriority" VisibleIndex="100" Width="40px" 
                                     Caption="<%$ Dict:InventoryGrid.PriorityColumn %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <CellStyle Wrap="False">
            </CellStyle>
            <HeaderStyle Wrap="True" />
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn FieldName="Quantity" VisibleIndex="110" Width="50px"
                                     Caption="<%$ Dict:InventoryGrid.QuantityColumn %>" PropertiesTextEdit-DisplayFormatString="f0">
            <Settings AllowAutoFilterTextInputTimer="False"  />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
            <Settings AllowAutoFilterTextInputTimer="False" />
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn VisibleIndex="120" Name="OpenQuantityColumn" FieldName="OpenQuantity" Width="50px"
                                     Caption="<%$ Dict:InventoryGrid.OpenQuantityColumn %>" UnboundType="Decimal"
                                      PropertiesTextEdit-DisplayFormatString="f0">
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn FieldName="originalQuantity" VisibleIndex="130" Width="50px" 
                                     Caption="<%$ Dict:InventoryGrid.originalQuantity %>"
                                      PropertiesTextEdit-DisplayFormatString="f0">
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn FieldName="CustomerCatalougeCode" VisibleIndex="140" Width="100px"
                                     Caption="<%$ Dict:ClienteditWoForm.CustomerCatalougeCode %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
            
          </dx:GridViewDataTextColumn>
          <%--<dx:GridViewDataTextColumn FieldName="ContractorCatalogueCode" VisibleIndex="14" Width="100px"
                                     Caption="<%$ Dict:InventoryGrid.CustCatalougeCodeColumn %>" >--%>
            <dx:GridViewDataTextColumn FieldName="ContractorCatalogueCode" VisibleIndex="150" Width="100px"
                                     Caption="<%$ Dict:InventoryGrid.ContrCatalogueCodeColumn %>" >                        
                                     
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn FieldName="ProductDescription" VisibleIndex="160" Width="90px"
                                     Caption="<%$ Dict:InventoryGrid.ProductDescriptionColumn %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <EditCellStyle Wrap="False">
            </EditCellStyle>
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataMemoColumn FieldName="TextFieldA" VisibleIndex="170" Width="70px"
                                     Caption="<%$ Dict:InventoryGrid.TextAColumn %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataMemoColumn>
          
          <dx:GridViewDataTextColumn FieldName="TextFieldB" VisibleIndex="180" Width="70px"
                                     Caption="<%$ Dict:InventoryGrid.TextFieldBColumn %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn FieldName="TextFieldC" VisibleIndex="190" Width="70px"
                                     Caption="<%$ Dict:TextFieldC %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn FieldName="Remarks" VisibleIndex="200" Width="70px"
                                     Caption="<%$ Dict:InventoryGrid.RemarksColumn %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn FieldName="OrderNumber" VisibleIndex="210" Width="50px"
                                     Caption="<%$ Dict:InventoryGrid.OrderNumberColumn %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn  FieldName="RequestedBalance" VisibleIndex="220" Name="RequestedBalanceColumn"
                                      Caption="<%$ Dict:RequestedBalance %>"
            Width="60px" UnboundType="Decimal">
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn FieldName="PlannedBalance" VisibleIndex="230" Name="PlannedBalanceColumn" 
                                     Caption="<%$ Dict:PlannedBalance %>" 
            Width="50px" UnboundType="Decimal">
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn FieldName="SplitId" VisibleIndex="240" Width="30px" ReadOnly="True"
                                     Caption="<%$ Dict:InventoryGrid.SplitIdColumn %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataDateColumn FieldName="DateFieldA" VisibleIndex="250" Width="70px" Visible="True"
                                     Caption="<%$ Dict:InventoryGrid.DateAColumn %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataDateColumn>
          
          <dx:GridViewDataDateColumn FieldName="DateFieldB" VisibleIndex="260" Width="70px" Visible="True"
                                     Caption="<%$ Dict:InventoryGrid.DateBColumn %>" >
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataDateColumn>
          
          <dx:GridViewDataTextColumn FieldName="WorkOrderId" ReadOnly="True" Visible="False" VisibleIndex="270" Width="150px">
            <EditFormSettings Visible="False" />
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn FieldName="ContractorId" VisibleIndex="280" Width="110px" Visible="False">
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn FieldName="CustomerId" VisibleIndex="290" Width="110px" Visible="False">
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataDateColumn FieldName="UpdateDate" Visible="False" VisibleIndex="300" Width="150px">
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataDateColumn>
          
          <dx:GridViewDataDateColumn FieldName="DateCreated" Visible="False" VisibleIndex="310" Width="150px">
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
            
          </dx:GridViewDataDateColumn>
          
          <dx:GridViewDataTextColumn FieldName="UpdateBy" Visible="False" VisibleIndex="320" Width="150px">
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn FieldName="TotalSum" Visible="False" VisibleIndex="330" Width="150px">
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataTextColumn FieldName="originalWoForDist" VisibleIndex="340" Width="80px" Visible="False">
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          
          <dx:GridViewDataDateColumn FieldName="OriginalPlannedDeliveryDate" Visible="False" VisibleIndex="350" Width="150px">
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataDateColumn>
          
          <dx:GridViewDataDateColumn FieldName="OriginalRequestedDeliveryDate" Visible="False" VisibleIndex="360" Width="150px">

            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataDateColumn>
          
          <dx:GridViewDataTextColumn FieldName="CustomerOrderNumber" Visible="False" VisibleIndex="370" Width="100px">
            <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>
          <%--<dx:GridViewDataTextColumn FieldName="Units" VisibleIndex="380" Width="70px" Caption="<%$ Dict:ClienteditWoForm.Units %>">
          <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataTextColumn>--%>
          <dx:GridViewDataCheckColumn FieldName="debate" Visible="true" VisibleIndex="390" Width="70px">
          <Settings AllowAutoFilterTextInputTimer="False" />
            <HeaderStyle Wrap="True" />
            <CellStyle Wrap="False">
            </CellStyle>
          </dx:GridViewDataCheckColumn>         
        </Columns>
        <StylesPager>
          <Button HorizontalAlign="Left">
          </Button>
        </StylesPager>
        <Settings ShowFilterRow="True" ShowGroupPanel="True" ShowHorizontalScrollBar="True" ShowFilterRowMenu="True" />
        <Templates>
           
          <DetailRow>
            <div id="DistributionDiv" runat="server"  />
               <dx:ASPxGridView ID="DistributionGridView" runat="server" AutoGenerateColumns="False" DataSourceID="DistributionDataSource"
                KeyFieldName="WorkOrderId" 
                OnBeforePerformDataSelect="DistributionGridView_BeforePerformDataSelect" Width="384px">
                <SettingsBehavior ProcessSelectionChangedOnServer="True" AllowFocusedRow="True" />
                <Columns>
                  <dx:GridViewCommandColumn VisibleIndex="0">
                    <EditButton Visible="True">
                    </EditButton>
                  </dx:GridViewCommandColumn>
                  <dx:GridViewDataTextColumn FieldName="WorkOrderId" ReadOnly="True" VisibleIndex="0" Visible="False">
                    <EditFormSettings />
                  </dx:GridViewDataTextColumn>
                  <dx:GridViewDataDateColumn FieldName="PlannedDelivaryDate" VisibleIndex="9" Visible="True"
                                             Caption="<%$ Dict:ClienteditWoForm.PlannedDelivaryDate %>" >
                  </dx:GridViewDataDateColumn>
                  <dx:GridViewDataDateColumn FieldName="ActualDelivaryDate" VisibleIndex="10" Visible="True"
                                             Caption="<%$ Dict:InventoryGrid.ActualDelivaryDateColumn %>" >
                  </dx:GridViewDataDateColumn>
                  <dx:GridViewDataTextColumn FieldName="Quantity" VisibleIndex="12" Visible="True" Width="100px"
                                             Caption="<%$ Dict:InventoryGrid.QuantityColumn %>" >
                  </dx:GridViewDataTextColumn>
                  <dx:GridViewDataTextColumn FieldName="TextFieldB" VisibleIndex="17" Visible="true" Caption="TextFieldB">
                  
                  </dx:GridViewDataTextColumn>
                </Columns>
              </dx:ASPxGridView>
          </DetailRow>
          <EditForm>
            <div style="width: 900px">
              <dx:ASPxGridViewTemplateReplacement ReplacementType="EditFormEditors" ID="editors" runat="server"></dx:ASPxGridViewTemplateReplacement>
              <dx:ASPxGridViewTemplateReplacement ReplacementType="EditFormUpdateButton" ID="edit" runat="server"></dx:ASPxGridViewTemplateReplacement>
              <dx:ASPxGridViewTemplateReplacement ReplacementType="EditFormCancelButton" ID="cancel" runat="server"></dx:ASPxGridViewTemplateReplacement>
            </div>
          </EditForm>
        </Templates>
        <SettingsDetail ShowDetailRow="True" AllowOnlyOneMasterRowExpanded="True"  />
      </dx:ASPxGridView>
   
      <br />
      
      <asp:Panel ID="DisqualifyPanel" runat="server" Visible="false">
          <div style="background-color:White; padding: 10px 10px; border:5px solid Grey; position:absolute; top:120px; left:25%; z-index:1000; " class="align">
              <asp:HiddenField ID="DisqualifyWOId" runat="server" />
              <asp:Label ID="CFOrderDetailsLabel" runat="server" Text="<%$ Dict:InventoryGrid.Disqualify %>" CssClass="SC_BigText"></asp:Label>
              <br /><br />  
              <asp:Label ID="QtyLabel" runat="server" CssClass="regFont"></asp:Label>
              <asp:HiddenField ID="QuantityHF" runat="server" />
              <asp:TextBox ID="DisqualifyQtyTextBox" runat="server" CssClass="regFont"></asp:TextBox>
              <br /><br />
              <asp:Label ID="ReasonsTitleLabel" runat="server" Text="<%$ Dict:InventoryGrid.DisqualifyReasons %>" CssClass="regFont"></asp:Label>
              <br />
              <asp:Repeater ID="DeleteReasonsRepeater" runat="server" DataSourceID="DeleteReasonsDataSource">
              <ItemTemplate>
                <asp:HiddenField ID="ReasonIdHiddenField" runat="server" Value='<%# Eval("ReasonId") %>' />
                <asp:CheckBox ID="ReasonCheckBox" runat="server" Text='<%# Eval("CancelReason") %>' CssClass="regFont" />
              </ItemTemplate>
              <SeparatorTemplate><br /></SeparatorTemplate>
              <FooterTemplate><br /></FooterTemplate>
              </asp:Repeater>
              <br /><br />
              <asp:Button ID="DisqualifyButton" runat="server" OnClick="DisqualifyWorkOrder" Text="<%$ Dict:InventoryGrid.Disqualify %>" CssClass="SC_Button" />
              &nbsp;
              <asp:Button ID="DisqualifyCancelButton" runat="server" Text="Cancel" OnClick="CancelDisqualify" CssClass="SC_Button" />
              &nbsp;
              <asp:Button ID="DisqualifyCloseButton" runat="server" Text="<%$ Dict:General.Close %>" OnClick="CancelDisqualify" CssClass="SC_Button" />
              
              <br /><br />
              <asp:Label ID="DisqualifyMessageLabel" runat="server" ></asp:Label>
          </div>
      </asp:Panel>
      
      <div class="clr"></div>
          <div class="floater">
          <asp:Label ID="TMPMessageLabel" runat="server" CssClass="regFont"></asp:Label>
          <asp:HiddenField ID="ToRemoveArrayHiddenField" runat="server" />
          <asp:HiddenField ID="ToggleDebateArrayHiddenField" runat="server" />
          
          
          <asp:Button ID="DeleteSelectedButton" runat="server" CssClass="SC_Button" Text="Delete selected"
           OnClientClick="return (WriteOrdersToRemove())" OnClick="RemoveSelectedPaka"/>
           &nbsp;
          <asp:Button ID="MarkSelectedDebate" runat="server" CssClass="SC_Button" Text="Change debate value in selected"
           OnClientClick="return (WriteOrdersToToggleDebate())" OnClick="MarkSelectedAsDebate"/>
           </div>
           <div style="clear:both;"></div>
           <dx:ASPxGridViewExporter ID="gridExport" runat="server" GridViewID="InventoryGrid" ></dx:ASPxGridViewExporter>
  
      
        <dx:ASPxLoadingPanel ID="LoadingPanel" runat="server" ClientInstanceName="LoadingPanel">
        </dx:ASPxLoadingPanel>
       
        <asp:Table ID="MainSpliterTable" runat="server" Height="140px" >
        <asp:TableRow Height="25px">
        </asp:TableRow>
        <asp:TableRow>
          <asp:TableCell Width="30%">
           
            <dx:ASPxRoundPanel ID="SpliterPanelNew" HeaderText="Spliter" runat="server" Width="200px">
              <Border BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
              
              <PanelCollection>
              
                <dx:PanelContent ID="PanelContent1" runat="server">
            
                   <div style="padding:2px 2px 2px 2px;">
                  <asp:Table ID="SpliterTable" Visible="true" runat="server">
                    <asp:TableRow>
                      <asp:TableCell Width="30%">
                        <asp:Table ID="Table1" runat="server">
                          <asp:TableRow>
                            <asp:TableCell>
                              <dx:ASPxLabel ID="SpliterLabel" Text="Quantity:" Width="100px" runat="server">
                              </dx:ASPxLabel>
                            </asp:TableCell>
                            <asp:TableCell>
                              <dx:ASPxTextBox ID="SpliterTextBox" runat="server" Width="90px">
                              </dx:ASPxTextBox>
                            </asp:TableCell>
                          </asp:TableRow>
                        </asp:Table>
                      </asp:TableCell>
                      <asp:TableCell> </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow Height="25px">
                    </asp:TableRow>
                    <asp:TableRow>
                      <asp:TableCell Width="30%">
                        <asp:Table ID="Table3" runat="server">
                          <asp:TableRow>
                            <asp:TableCell>
                              <dx:ASPxButton ID="SpliterUpdateButton" Text="Update" OnClick="SpliterUpdateButton_Click" runat="server">
                              </dx:ASPxButton>
                            </asp:TableCell>
                            <asp:TableCell>
                              <dx:ASPxButton ID="SpliterCancelButton" Text="Cancel" OnClick="SpliterCancelButton_Click" runat="server">
                              </dx:ASPxButton>
                            </asp:TableCell>
                          </asp:TableRow>
                        </asp:Table>
                      </asp:TableCell>
                      <asp:TableCell> </asp:TableCell>
                    </asp:TableRow>
                  </asp:Table>
                  </div>
                </dx:PanelContent>
              </PanelCollection>
            </dx:ASPxRoundPanel>
            
          </asp:TableCell>
          <asp:TableCell>
            <dx:ASPxLabel ID="ErrorMessageLabel" runat="server" Font-Size="Medium" ForeColor="Red" Text="Error Message Label">
            </dx:ASPxLabel>
          </asp:TableCell>
        </asp:TableRow>
      </asp:Table>
     
      
          <asp:SqlDataSource ID="DeleteReasonsDataSource" runat="server" SelectCommandType="StoredProcedure" 
            ConnectionString="<%$ ConnectionStrings:MLYConnectionString %>" SelectCommand="SCCOver_GetCancelReasons"></asp:SqlDataSource>           
      </ContentTemplate>
    </asp:UpdatePanel>
    

</asp:Content>
